package main

import (
	"fmt"
	"time"
)

func main() {
	cannel:=make(chan bool)
	for i := 0; i < 10; i++ {
		go worker(cannel)
	}
	time.Sleep(time.Second)
	close(cannel)
}

func worker(cannel chan bool) {
	for {
		select {
		default:
			fmt.Println("hello")
			// 正常工作
			case <-cannel: // 退出
		}
	}
}
